package cn.itcast.bos.dao.system;/**
 * Created with IntelliJ IDEA.
 *
 * @author: SOS
 * @create: 2018-03-11 21:31
 */

import cn.itcast.bos.domain.system.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @program: ideabos2.0
 * @description: Permission的持久层
 * @author: SOS
 * @create: 2018-03-11 21:31
 **/
public interface PermissionRepository extends JpaRepository<Permission,Integer> {

    @Query("from Permission p inner join fetch p.roles r inner join fetch r.users u where u.id = ?")
    List<Permission> findByUser(Integer id);
}
